﻿using TypeScriptProxyGenerator;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using ACServerApi.Extensions;
using System.Text;
using System.Collections.ObjectModel;

namespace ACServerApi.Models
{
    [TSGen(TSGenTag.ClientModel)]
    public class ACServer
    {
        public ACServer()
        {
            Configurations = new Collection<ACConfigBase>();
        }
        [Required]
        public int Id { get; set; }
        public string Name { get; set; }
        public bool Running { get; set; }
        public Collection<ACConfigBase> Configurations { get; set; }

        [TSGen(TSGenTag.Ignore)]
        public string SerializeToIni()
        {
            return SerializeToIni(false);
        }

        [TSGen(TSGenTag.Ignore)]
        public string SerializeToIni(bool writeComments)
        {
            var sb = new StringBuilder();
            foreach (var item in Configurations)
            {
                sb.AppendLine(item.SerializeToIni(writeComments));
            }
            return sb.ToString().Trim();
        }
    }
}